home *** CD-ROM | disk | FTP | other *** search
- Path: s02.pavilion.co.uk!usenet
- From: AJRobb@pavilion.co.uk (Andy J Robb)
- Newsgroups: comp.lang.c
- Subject: Re: need for function prototypes
- Date: Tue, 05 Mar 1996 03:18:02 GMT
- Organization: Pavilion Internet plc
- Message-ID: <4hgbo0$2fj@s02.pavilion.co.uk>
- References: <4gutho$o1a@mn5.swip.net>
- NNTP-Posting-Host: poolc35.pavilion.co.uk
- X-Newsreader: Forte Free Agent 1.0.82
-
- chris.rossall@mailbox.swipnet.se (Chris Rossall) wrote:
-
- >Hello I am having trouble understanding why I should use function
- >prototypes. I mean,if the function is defined before it is used,the
- >compiler should have enough information about the parameters to
- >produce correct code anyway.
-
- >-Chris
-
- -----BEGIN PGP SIGNED MESSAGE-----
-
- True, a function definition before a function call will serve as its
- own declaration especially if it is restricted to file scope (static).
- A lot of programs are written top-down. This leaves the function
- definition after the function call. To get around this, insert a
- function declaration before the function call.
-
- Function prototypes come in to their own when defining functions with
- external linkage. The declaration of these functions can then be
- included in other files where the function is called. Also, including
- the header file in the function source file allows the declaration to
- be checked against the definition.
-
- Regards,
- Andy Robb.
-
- -----BEGIN PGP SIGNATURE-----
- Version: 2.6.2i
-
- iQCVAwUBMTuyNpPl4P16x9sNAQFVIQQAvrKwK4vAjiGNYlP9olcWw6HkcJotYOhR
- PDtvkY5d6ZWKCiv/7zrpI3Z/rAh5ThbSqzSQxdu7pM+rwQJf98D+lTXv+pD4m1Yr
- zgr2+b88j5ttawySeQuzfOOCItb/jK5nSFMHQ1UO2o2Y8o3ELrCgG06tMAcmPaKW
- DCwdsVWMpIw=
- =dAKB
- -----END PGP SIGNATURE-----
-
- -----BEGIN PGP PUBLIC KEY BLOCK-----
- Version: 2.6.2i
-
- mQCNAy/MpRwAAAEEAOt6uBYqT8yv9EmqNhK8m6v+bYi8QjnGW3Bo6iU1gsMj5pa6
- MHgq99c8deADbE3cbJ6uZS9v5pZE3WCf6HCQjlB5iULA5RZzMdAumd/WUzuL9UT3
- B44D9EqqFIL79FlYb56v4oKFqFp1/J2bIpYUwnUvabGzGjdLrpPl4P16x9sNAAUR
- tCNBbmR5IEogUm9iYiA8QUpSb2JiQHBhdmlsaW9uLmNvLnVrPrQhQW5keSBSb2Ji
- IDxBSlJvYmJAcGF2aWxpb24uY28udWs+
- =/wVD
- -----END PGP PUBLIC KEY BLOCK-----
-
-